﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.iss.inventory.Entity;
using com.iss.inventory.Controllers;

namespace Staionery_Inventory.Presentation.StationeryRetrieval
{
    public partial class SRFList : System.Web.UI.Page
    {
        StationeryRetrievalController srfControl = new StationeryRetrievalController();
        List<SRF> srfList = new List<SRF>();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["empID"] == null)
            {
                Response.Redirect("~/Presentation/login.aspx");
            }

            Label lbl = this.Master.FindControl("lblLogInName") as Label;
            if (lbl != null)
            {
                lbl.Text = Session["UserName"].ToString();
            }

            srfList = srfControl.getAllSRFs();
            if (srfList.Count != 0)
            {
                gvSrfList.DataSource = srfList;
                gvSrfList.DataBind();
            }
        }


        protected void lbStatus_Click(object sender, EventArgs e)
        {

            LinkButton lb = sender as LinkButton;
            GridViewRow gvr = lb.NamingContainer as GridViewRow;
            int SRFID = int.Parse(gvr.Cells[0].Text);
            if (lb.Text == "Created")
            {
                Response.Redirect("~/Presentation/StationeryRetrieval/StationeryRetrievalForm.aspx?srfID=" + SRFID.ToString());
            }
            else
            {
                Response.Redirect("~/Presentation/Disbursement/AllDisbursementList.aspx?srfID=" + SRFID.ToString());
            }
        }
    }
}